package com.blog.service.interfaces;

import java.io.File;
import java.io.InputStream;

import org.json.JSONException;

import com.qiniu.api.auth.AuthException;

public interface IQiniu {

	public abstract void setDomain(String domain);

	public abstract void setBucketName(String bucketName);

	//设置AccessKey
	public abstract void setAccessKey(String key);

	//设置SecretKey
	public abstract void setSecretKey(String key);

	//通过文件路径上传文件
	public abstract boolean uploadFile(String localFile) throws AuthException,
			JSONException;

	//通过File上传
	public abstract boolean uploadFile(File file) throws AuthException,
			JSONException;

	/**
	 * 从 inputstream 中写入七牛
	 * @param key 文件名
	 * @param content 要写入的内容
	 * @return
	 * @throws AuthException
	 * @throws JSONException
	 */
	public abstract boolean uploadFile(String key, InputStream inputStream)
			throws AuthException, JSONException;

	//获得下载地址
	public abstract String getDownloadFileUrl(String filename) throws Exception;

	//删除文件
	public abstract void deleteFile(String filename);

	/** 
	 * 获得一个UUID 
	 * @return String UUID 
	 */
	public abstract String getUUID();

}